package geno.app;

import java.awt.Dimension;

import geno.app.aspecttest.TestValues;

public class Rectangle implements Shape {

	private int height;
	private int width;
	
	public Rectangle() {
		super();
		this.height = 0;
		this.width = 0;
	}
	
	// accept only positive values then throw exception
	public Rectangle(int height, int width) {
		super();
		this.height = height;
		this.width = width;
	}
	
	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}
	
	public int getArea() {
		return height*width;
	}
	
	public String toString() {
		return "Rectangle: height=" + getHeight() + "; width=" + getWidth() + "; area=" + getArea() + ".";
	}
	
	public Dimension getDimension() {
		return new Dimension(this.width, this.height);
	}
	
	// Testing for the values of primitive member variables OK
	public static void main(String[] args) {
		// test for default constructor
		TestValues.testHeight = 0;
		TestValues.testWidth = 0;
		Rectangle rect = new Rectangle();
		rect.getArea();
		
		// test for area
		TestValues.testHeight = 100;
		TestValues.testWidth = 150;
		TestValues.testArea = TestValues.testHeight * TestValues.testWidth;
		Rectangle rect2 = new Rectangle(TestValues.testHeight, TestValues.testWidth);
		rect2.getArea();
		
	}
}
